<?php
/*
 * Creative Bulletin Board Generation 3
 * Version 1.0 Beta 1
 +------------------------------------
 * User Application Models: Groups
 * Started: September 17, 2009 7:16 PM
 * Script version: 1.0
 */
class groups{
	public function create($groupname, $groupdesc, $permissionmask, $prefix = "", $suffix = "", $admin = 0, $smod = 0){
		global $db, $main;
		$groupname = mysql_real_escape_string(stripslashes($groupname));
		$groupdesc = mysql_real_escape_string(stripslashes($groupdesc));
		$permissionmask = intval($permissionmask);
		$prefix = stripslashes(str_replace("'", '"', $prefix));
		$suffix = stripslashes(str_replace("'", '"', $suffix));
		$admin = intval($admin);
		$smod = intval($smod);
		$built = "INSERT INTO `".DB_PREFIX."groups` (
			`id`, `groupname`, `groupdesc`, `permissionmask`, `group_display_prefix`, `group_display_suffix`, `is_admin`, `is_smod`, `is_native`, `is_banned`)
			VALUES(NULL, '{$groupname}', '{$groupdesc}', {$permissionmask}, '{$prefix}', '{$suffix}', {$admin}, {$smod}, 0, 0)";
		$query = $db->query($built);
		return $query;
	}
	
	public function select_all(){
		global $db;
		$query = $db->select("groups");
		return $query;
	}
}
